<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Redis;
class UpLog extends Model
{
    protected $table = 'uplog';
    
    /**
     * 是否主动维护时间戳
     *
     * @var bool
     */
    public $timestamps = false;
    
    public static function createLog($paid,$aid,$credit){
        if (Redis::get('uplogcredit'.$paid.$aid)) return;
        Redis::setex('uplogcredit'.$paid.$aid,3,1);
        UpLog::insert(array('paid'=>$paid,'aid'=>$aid,'credit'=>$credit,'createtime'=>time()));
    }
}
